#define  _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int pow(int i)
{
	int a = 0;
	while (i)
	{
		a++;
		i = i / 10;
	}
	return a;
}
int jisuan(int i, int count)
{
	int a = 0;
	int c = 0;
	int f = 0;
	int d = 1;
	f = count;
	while (f)
	{
		a = i % 10;
		i = i / 10;
		for (int e = count;e > 0;e--)
		{
			d = d * a;
		}
		c = c + d;
		d = 1;
		f--;
	}
	return c;
}
int main()
{
	int i = 0;
	for (i = 0;i < 100001;i++)
	{
		int count = pow(i);
		int num = jisuan(i, count);
		if (i == num)
			printf("%d ", i);
	}
	return 0;
}